/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package util;

/**
 *
 * @author Alberto
 */
public class Date {

    private int year,month,day;

    public Date(int year, int month, int day){
        this.day = day;
        this.month = month;
        this.year = year;
    }

    public int getDay() {
        return day;
    }

    public void setDay(int day) {
        this.day = day;
    }

    public int getMonth() {
        return month;
    }

    public void setMonth(int month) {
        this.month = month;
    }

    public int getYear() {
        return year;
    }

    public void setYear(int year) {
        this.year = year;
    }

    @Override
    public String toString(){
        return (year+"/"+month+"/"+day);
    }

    public int compareTo(Date date){
        int res = 0;
        if(date.year>this.year){
            res = -1;
        }else if(date.year<this.year){
            res = 1;
        }else{
            if(date.month>this.month){
                res = -1;
            }else if(date.month<this.month){
                res = 1;
            }else{
                if(date.day>this.day){
                    res = -1;
                }else if(date.day<this.day){
                    res = 1;
                }
            }
        }
        return res;
    }

    @Override
    public Object clone() throws CloneNotSupportedException{
        Date clon = new Date(this.year,this.month,this.day);
        return clon;
    }

}
